package frontend.parser.node.stmt;

import frontend.lexer.token.Token;
import frontend.parser.node.Node;
import frontend.parser.node.TokenNode;

import java.util.ArrayList;

public class Block extends Node {
    // 语句块     Block → '{' { BlockItem } '}'
    private final ArrayList<BlockItem> blockItemList = new ArrayList<>();
    private TokenNode endRBrace;
    public void addBlockItem(BlockItem blockItem) {
        super.add(blockItem);
        blockItemList.add(blockItem);
    }
    public void addEndRBrace(TokenNode tokenNode) {
        super.add(tokenNode);
        this.endRBrace = tokenNode;
    }

    public ArrayList<BlockItem> getBlockItemList() {
        return blockItemList;
    }

    public Token getEndRBraceToken() {
        return endRBrace.getToken();
    }
}
